
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>
        员工添加
    </title>
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.css" rel="stylesheet">
    <link href="https://cdn.bootcss.com/normalize/7.0.0/normalize.css" rel="stylesheet">
    <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.js"></script>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="css/main.css" media="all">
    <style>
        .imgs{display: none;}
        .picture{display: none;}
    </style>

</head>
<body>
<script>
    const PERMISSIONS_ADD_URL = "http://localhost:8080/commodity/insert"
    $(function () {
        init();
    })

    function init() {
        $("#save").click(function () {
            let data = {
                name: $("#name").val(),
                price: $("#price").val(),
                img: $("#img").val(),
                inventory: $("#inventory").val(),
                sorted: $("#sorted").val(),
                particulars: $("#particulars").val()
            }

            $.get(PERMISSIONS_ADD_URL, data, function (result) {
                if (result.status === 200) {
                    alert("添加成功！")
                }

            })
        })
    }

</script>
<div class="x-body">
    <form class="layui-form layui-form-pane" action="" id="add">
        <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">


            <div class="layui-tab-content" >
                <div class="layui-tab-item layui-show">
                    <input type="hidden" name="id" value="">
                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            <span class='x-red'>*</span>物名
                        </label>
                        <div class="layui-input-block">
                            <input type="text" name="pet_name" autocomplete="off"
                                   class="layui-input" value="" id="name">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            <span class='x-red'>*</span>价格
                        </label>
                        <div class="layui-input-block">
                            <input type="text" name="pet_name" autocomplete="off"
                                   class="layui-input" value="" id="price">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            <span class='x-red'>*</span>图片
                        </label>
                        <div class="layui-input-block">
                            <input type="text" name="pet_name" autocomplete="off"
                                   class="layui-input" value="" id="img">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            <span class='x-red'>*</span>库存
                        </label>
                        <div class="layui-input-block">
                            <input type="text" name="pet_color" autocomplete="off"
                                   class="layui-input" value="" id="inventory">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            <span class='x-red'>*</span>分类
                        </label>
                        <div class="layui-input-block">
                            <input type="text" name="pet_color" autocomplete="off"
                                   class="layui-input" value="" id="sorted">
                        </div>
                    </div>

                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">
                            说明
                        </label>
                        <div class="layui-input-block">
                            <textarea name="desc" class="layui-textarea" id="particulars"></textarea>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <button class="layui-btn" type="button" lay-filter="add" lay-submit="" id="save" onclick="window.close();">
                            保存
                        </button>
                    </div>

                    <div style="height:100px;"></div>
                </div>



            </div>

        </div>
    </form>
</div>


</body>
</html>